package com.xiaoyu.lanling.feature.visitor.fragment

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.xiaoyu.lanling.R
import com.xiaoyu.lanling.feature.visitor.controller.FootprintListViewController
import com.xiaoyu.lanling.feature.visitor.data.FootprintListViewData
import com.xiaoyu.lanling.view.OnShowFragment
import kotlinx.android.synthetic.main.fragment_foot_print.*

class FootprintFragment : OnShowFragment() {

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        return inflater.inflate(R.layout.fragment_foot_print, container, false)
    }

    override fun onViewCreatedSafelyAfterAppFinishInit(view: View, savedInstanceState: Bundle?) {
        initData()
    }

    private fun initData() {
        val listData = FootprintListViewData()

        context?.let {
            val controller = FootprintListViewController.create(it, listData, visited_swipe_refresh_layout, visited_recyclerview)
            controller.loadFirstPageData()
        }
    }
}